<%@ page import="com.alevsk.antwars.MapLauncher" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%
	
	/*Imprimimos los resultados que seran retornados al html (la vista)*/
	/*El objeto REQUEST es el que permite el paso de parametros del html al JSP*/
	  	
  	DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
    Date date = new Date();
  	
  	String nameOfTextFile = request.getRealPath("/")+"/files/mapa-"+dateFormat.format(date)+".txt";
  	try {   
      	PrintWriter pw = new PrintWriter(new FileOutputStream(nameOfTextFile));
		String army = request.getParameter("guerrera")+":"+request.getParameter("exploradora")+":"+request.getParameter("recolectora")+"\n";
		String newMap = army + request.getParameter("ancho")+":"+request.getParameter("alto")+"\n"+request.getParameter("mapa");
		pw.println(newMap);
      	pw.close();
  	} catch(IOException e) {
     	out.println(e.getMessage());
  	}
  	  	
%>
<%= "files/mapa-"+dateFormat.format(date)+".txt" %>
